package org.nstack.header.zone;

import org.nstack.header.message.APIDeleteMessage;
import org.nstack.header.message.APIEvent;
import org.nstack.header.message.APIMessage;
import org.nstack.header.message.APIParam;
import org.springframework.http.HttpMethod;
import org.nstack.header.notification.ApiNotification;
import org.nstack.header.rest.RestRequest;


@RestRequest(
        path = "/zones/{uuid}",
        method = HttpMethod.DELETE,
        responseClass = APIDeleteZoneEvent.class
)
public class APIDeleteZoneMsg extends APIDeleteMessage implements ZoneMessage {

    @APIParam(resourceType = ZoneVO.class, successIfResourceNotExisting = true)
    private String uuid;

    public APIDeleteZoneMsg() {
    }

    public APIDeleteZoneMsg(String uuid) {
        super();
        this.uuid = uuid;
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    @Override
    public String getZoneUuid() {
        return getUuid();
    }
 
    public static APIDeleteZoneMsg __example__() {
        APIDeleteZoneMsg msg = new APIDeleteZoneMsg();
        msg.setUuid(uuid());
        msg.setDeletionMode(DeletionMode.Permissive);
        return msg;
    }

    public ApiNotification __notification__() {
        APIMessage that = this;

        return new ApiNotification() {
            @Override
            public void after(APIEvent evt) {
                ntfy("Deleted").resource(uuid,ZoneVO.class.getSimpleName())
                        .messageAndEvent(that, evt).done();
            }
        };
    }

}
